# -*- encoding:utf-8 -*-
"""
@作者：jiajun_Tang
@文件名：Logic_Center.py
@时间：2023/3/27  下午 03:13
@文档说明: 程序控制中心
"""

import os
import cv2
from time import time
import numpy as np

from image_detection.detections_1 import defect_detect



def single_processing():
    img = get_img()

    '''
    # #  使用多进程进行程序处理
    pool = Pool(processes=8)  # 开启进程池
    results = [pool.apply_async(defect_detect, args=(img, 0, 0))]
    pool.close()  # 关闭进程池，表示不能再往进程池中添加进程，需要在join之前调用
    pool.join()  # 等待进程池中的所有进程执行完毕
    print("Sub-process(es) done.")

    for res in results:
        print("我拿到值了", len(res.get()))
        img_detect, contours = res.get()

    # return img_detect, contours
    '''

    img_detect, contours = defect_detect(img, 0, 0)

    # # 使用多线程进行处理
    # t = MyThread(defect_detect, args=(img, 0, 0))
    # t.start()
    # t.join()
    # print("Sub-process(es) done.")
    # img_detect, contours = t.get_result()

    return img_detect, contours

